//
//  BCBottomButton.m
//  GSBlockChain
//
//  Created by guoshikeji_a on 2018/11/23.
//  Copyright © 2018年 guoshikeji. All rights reserved.
//

#import "BCBottomButton.h"

@interface BCBottomButton ()

@property (nonatomic, strong) CAGradientLayer *safeAreaLayer;

@end

@implementation BCBottomButton

- (instancetype)init
{
    self = [super init];
    if (self) {
        [self setupSubviews];
    }
    return self;
}
- (void)setupSubviews {
//    self.safeAreaLayer = [CAGradientLayer layer];
//    self.safeAreaLayer.startPoint = CGPointMake(0.5, 0);
//    self.safeAreaLayer.endPoint = CGPointMake(0.5, 1);
//    [self.layer addSublayer:self.safeAreaLayer];
    //
    self.displayButton = [QMUIButton new];
    self.displayButton.titleLabel.font = [self.class normalDisplayFont];
    self.displayButton.titleLabel.adjustsFontSizeToFitWidth = true;
    [self.displayButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [self addSubview:self.displayButton];
    [self.displayButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.right.mas_equalTo(self);
        make.height.mas_equalTo(BCBottomViewHeight);
    }];
    self.displayButton.userInteractionEnabled = false;
    
    self.adjustsButtonWhenHighlighted = false;
    self.adjustsButtonWhenDisabled = false;
}

- (void)setHighlighted:(BOOL)highlighted {
    [super setHighlighted:highlighted];
    //
    self.displayButton.titleLabel.alpha = highlighted?.5:1;
}

- (void)layoutSubviews {
    [super layoutSubviews];
//    self.safeAreaLayer.frame = CGRectMake(0, BCBottomViewHeight, self.frame.size.width, Height_Bottom_SafeArea);
}


+ (UIFont *)normalDisplayFont {
    return [UIFont systemFontOfSize:18 weight:UIFontWeightMedium];
}


+ (CGFloat)defaultHeight {
    return BCBottomViewHeight+Height_Bottom_SafeArea;
}


@end
